<template>
  <div class="sub-menu" 
  @mouseenter="showSubMenu" @mouseleave="hideSubMenu">
    <div class="title">
      <slot name="title"></slot>
      <span class="icon">&gt;</span>
    </div>
    <div class="sub-itme" v-show="subMenuShow">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "Submenu",

  data() {
    return {
      subMenuShow: false,
    };
  },
  setup() {
   
  },
  mounted() {},

  methods: {
    showSubMenu() {
      this.subMenuShow = true;
    },
    hideSubMenu() {
      this.subMenuShow = false;
    },
  },
};
</script>

<style  scoped>
.sub-menu {
  position: relative;
  line-height: 50px;
  text-align: center;
}
.title {
  position: relative;
  line-height: 50px;
  text-align: center;
}
.icon {
  position: absolute;
  top: 0;
  right: 15px;
}
.sub-itme {
  position: absolute;
  left: 100%;
  top: 0;
  width: 100%;
  background: #333;
}
</style>